package org.jeecg.report.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.jeecg.report.entity.QisSpcPointValue;
import org.jeecg.report.service.AvailabilityReportService;
import org.jeecg.report.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

import static kotlin.reflect.jvm.internal.impl.builtins.StandardNames.FqNames.list;

/**
 * @author lichunyang
 * @ClassName QisSpcController
 * @Description SPC控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping(value = "/report/ftq")
public class FTQReportController {
    @Autowired
    private ReportService reportService;
    @GetMapping("/getFTQReport")
    @DS("#header.his")
    @ApiOperation(value = "获取FTQ报表统计数据", notes = "传入param")
    public Result<Map<String, Object>> getFTQReport(@RequestParam Map<String, Object> params) {
        Map<String, Object> ftqReport = reportService.getFTQReport(params);
        return Result.OK(ftqReport);
    }

    /**
     * 导出excel
     *
     * @param request
     * @param param
     */
    @RequestMapping(value = "/exportXls")
    @DS("#header.his")
    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, @RequestParam  Map<String, Object> param) {
        return reportService.exportFtqXls(request,response, param);
    }
}
